<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Requests\UserRequest;
//use App\Http\Requests\LoginRequest;

use App\Models\User;
use Auth;

class AuthController extends Controller
{
    //注册表单

	public function create()
	{
		return view('home.auth.create');
	}

    //保存用户信息
    public function store(UserRequest $request)
    {
    	$data = $request->all();
    	$user = User::create($data);
    	Auth::login($user);
    }

    //登录
    public function login(Request $request)
    {
        $data = $requset->only('email', 'password');
        if(Auth::attempt($data))
        {
            return redirect()->intended('user');
        }
    }

    public function delete()
    {

    }
}
